#include "ChineseChessBoard.h"
#include "ChineseChess.h"
#include "../framework/ChessProtoManager.h"
void ChineseChessBoard::setChess(QPoint p,std::string key){
    _chessBoard[p.x()][p.y()] = ChessProtoManager<ChineseChess>::getChess(key);
}
void ChineseChessBoard::initialBoard(){
    setChess(QPoint(0,4),"r_1");
    setChess(QPoint(0,3),"r_2");
    setChess(QPoint(0,5),"r_2");
    setChess(QPoint(0,2),"r_3");
    setChess(QPoint(0,6),"r_3");
    setChess(QPoint(0,1),"r_4");
    setChess(QPoint(0,7),"r_4");
    setChess(QPoint(0,0),"r_5");
    setChess(QPoint(0,8),"r_5");
    setChess(QPoint(2,1),"r_6");
    setChess(QPoint(2,7),"r_6");
    setChess(QPoint(3,0),"r_7");
    setChess(QPoint(3,2),"r_7");
    setChess(QPoint(3,4),"r_7");
    setChess(QPoint(3,6),"r_7");
    setChess(QPoint(3,8),"r_7");

    setChess(QPoint(9,4),"b_1");
    setChess(QPoint(9,3),"b_2");
    setChess(QPoint(9,5),"b_2");
    setChess(QPoint(9,2),"b_3");
    setChess(QPoint(9,6),"b_3");
    setChess(QPoint(9,1),"b_4");
    setChess(QPoint(9,7),"b_4");
    setChess(QPoint(9,0),"b_5");
    setChess(QPoint(9,8),"b_5");
    setChess(QPoint(7,1),"b_6");
    setChess(QPoint(7,7),"b_6");
    setChess(QPoint(6,0),"b_7");
    setChess(QPoint(6,2),"b_7");
    setChess(QPoint(6,4),"b_7");
    setChess(QPoint(6,6),"b_7");
    setChess(QPoint(6,8),"b_7");
}
void ChineseChessBoard::resetChessBoard(){
    for(int i=0;i<=_chessBoardLength;i++){
        for(int j=0;j<=_chessBoardWidth;j++){
            _chessBoard[i][j] = NULL;
        }
    }
    initialBoard();
}
